package com.huilian.iotbox.admin.wap.controller;

import com.huilian.iotbox.admin.wap.service.MerchantPayCompanyService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.MerchantDto;
import com.huilian.iotbox.data.po.Merchant;
import com.huilian.iotbox.data.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author 谢洛涛
 * @date 2021/6/15 17:23
 */
@RestController
@RequestMapping("/api/merchantPayCompany")
public class MerchantPayCompanyController extends UserInfoController {
    @Autowired
    private MerchantPayCompanyService merchantPayCompanyService;

    @GetMapping("/findPayCompany")
    public ServerResponse findPayCompany(Merchant merchant, HttpServletRequest request) {
        UserInfo userInfo = super.getLoginUserInfo(request);
        return merchantPayCompanyService.findPayCompany(merchant);
    }
    @GetMapping("/findPayCompanyByApplet")
    public ServerResponse findPayCompanyByApplet(String payCompanyCode, HttpServletRequest request) {
        UserInfo userInfo = super.getLoginUserInfo(request);
        return merchantPayCompanyService.findPayCompanyByApplet(payCompanyCode);
    }

    @GetMapping("/findMerchantPayCompany")
    public ServerResponse findMerchantPayCompany(MerchantDto merchantDto, HttpServletRequest request) {
        UserInfo userInfo = super.getLoginUserInfo(request);
        return ServerResponse.createBySuccess(merchantPayCompanyService.findMerchantPayCompany(merchantDto));
    }

    @GetMapping("/findYeahkaOpenSplitStatus")
    public ServerResponse findYeahkaOpenSplitStatus(MerchantDto merchantDto, HttpServletRequest request) {
        UserInfo userInfo = super.getLoginUserInfo(request);
        return merchantPayCompanyService.findYeahkaOpenSplitStatus(merchantDto);
    }
}
